package com.yk.airline.model;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Project Name:airlinecrawler
 * File Name:AnalysisDataModel
 * Package Name:com.yk.airline.model
 * Date:2018/2/1 17:47
 * Author:zhangshaoyang
 * Description:
 * Copyright (c) 2018, 重庆云凯科技有限公司 All Rights Reserved.
 */
@Entity
@Table(name = "analysis_data", schema = "cykspider", catalog = "")
public class AnalysisDataModel {
    private String id;
    private String airCompany;
    private String flightNumber;
    private String airLine;
    private Double lowestPrice;
    private Double specialPrice;
    private Double preferredPrice;
    private String preferredInfo;
    private Timestamp departureTime;
    private Timestamp arriveTime;
    private String website;
    private Timestamp createTime;
    private Timestamp updateTime;
    private CaptureMarkModel captureMarkByCaptureTime;

    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Id
    @Column(name = "id", nullable = false, length = 255)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "air_company", nullable = true, length = 255)
    public String getAirCompany() {
        return airCompany;
    }

    public void setAirCompany(String airCompany) {
        this.airCompany = airCompany;
    }

    @Basic
    @Column(name = "flight_number", nullable = true, length = 50)
    public String getFlightNumber() {
        return flightNumber;
    }

    public void setFlightNumber(String flightNumber) {
        this.flightNumber = flightNumber;
    }

    @Basic
    @Column(name = "air_line", nullable = true, length = 255)
    public String getAirLine() {
        return airLine;
    }

    public void setAirLine(String airLine) {
        this.airLine = airLine;
    }

    @Basic
    @Column(name = "lowest_price", nullable = true, precision = 0)
    public Double getLowestPrice() {
        return lowestPrice;
    }

    public void setLowestPrice(Double lowestPrice) {
        this.lowestPrice = lowestPrice;
    }

    @Basic
    @Column(name = "special_price", nullable = true, precision = 0)
    public Double getSpecialPrice() {
        return specialPrice;
    }

    public void setSpecialPrice(Double specialPrice) {
        this.specialPrice = specialPrice;
    }

    @Basic
    @Column(name = "preferred_price", nullable = true, precision = 0)
    public Double getPreferredPrice() {
        return preferredPrice;
    }

    public void setPreferredPrice(Double preferredPrice) {
        this.preferredPrice = preferredPrice;
    }

    @Basic
    @Column(name = "preferred_info", nullable = true, length = 255)
    public String getPreferredInfo() {
        return preferredInfo;
    }

    public void setPreferredInfo(String preferredInfo) {
        this.preferredInfo = preferredInfo;
    }

    @Basic
    @Column(name = "departure_time", nullable = true)
    public Timestamp getDepartureTime() {
        return departureTime;
    }

    public void setDepartureTime(Timestamp departureTime) {
        this.departureTime = departureTime;
    }

    @Basic
    @Column(name = "arrive_time", nullable = true)
    public Timestamp getArriveTime() {
        return arriveTime;
    }

    public void setArriveTime(Timestamp arriveTime) {
        this.arriveTime = arriveTime;
    }

    @Basic
    @Column(name = "website", nullable = true, length = 255)
    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    @Basic
    @Column(name = "create_time", nullable = true)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "update_time", nullable = true)
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AnalysisDataModel that = (AnalysisDataModel) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (airCompany != null ? !airCompany.equals(that.airCompany) : that.airCompany != null) return false;
        if (flightNumber != null ? !flightNumber.equals(that.flightNumber) : that.flightNumber != null) return false;
        if (airLine != null ? !airLine.equals(that.airLine) : that.airLine != null) return false;
        if (lowestPrice != null ? !lowestPrice.equals(that.lowestPrice) : that.lowestPrice != null) return false;
        if (specialPrice != null ? !specialPrice.equals(that.specialPrice) : that.specialPrice != null) return false;
        if (preferredPrice != null ? !preferredPrice.equals(that.preferredPrice) : that.preferredPrice != null)
            return false;
        if (preferredInfo != null ? !preferredInfo.equals(that.preferredInfo) : that.preferredInfo != null)
            return false;
        if (departureTime != null ? !departureTime.equals(that.departureTime) : that.departureTime != null)
            return false;
        if (arriveTime != null ? !arriveTime.equals(that.arriveTime) : that.arriveTime != null) return false;
        if (website != null ? !website.equals(that.website) : that.website != null) return false;
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (airCompany != null ? airCompany.hashCode() : 0);
        result = 31 * result + (flightNumber != null ? flightNumber.hashCode() : 0);
        result = 31 * result + (airLine != null ? airLine.hashCode() : 0);
        result = 31 * result + (lowestPrice != null ? lowestPrice.hashCode() : 0);
        result = 31 * result + (specialPrice != null ? specialPrice.hashCode() : 0);
        result = 31 * result + (preferredPrice != null ? preferredPrice.hashCode() : 0);
        result = 31 * result + (preferredInfo != null ? preferredInfo.hashCode() : 0);
        result = 31 * result + (departureTime != null ? departureTime.hashCode() : 0);
        result = 31 * result + (arriveTime != null ? arriveTime.hashCode() : 0);
        result = 31 * result + (website != null ? website.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "capture_time", referencedColumnName = "id")
    public CaptureMarkModel getCaptureMarkByCaptureTime() {
        return captureMarkByCaptureTime;
    }

    public void setCaptureMarkByCaptureTime(CaptureMarkModel captureMarkByCaptureTime) {
        this.captureMarkByCaptureTime = captureMarkByCaptureTime;
    }
}
